1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17">
4         Tìm kiếm theo giá: <b> <a href=
"./?act=price_m&page=<? echo $_REQUEST['page']; ?>&cat=<? echo $_REQUEST['cat']; ?>"><font color="#FFFFFF">Nh&#7853;p
5         M&#
7899;i</font></a><font color="#FFFFFF"> </font></b></td>
6       </tr>
7     </table>
8 <?
9
10 $MAXPAGE=
20;
11
12     
switch ($_GET['action'])
13     {
14         
case 'del' :
15             $id = $_GET[
'id'];
16             $result = mysql_query(
"select bds_loai from bds where bds_cat='".$id."'",$con);
17             
if (mysql_num_rows($result)<=0) {
18                 $sql =
"delete from bds_price where id='".$id."'";
19                 @$result = mysql_query($sql,$con);
20                 
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
21                 
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
22             }
else {
23                 echo
"<p align=center class='err'>&#272;ang có s&#7843;n ph&#7849;m s&#7917; d&#7909;ng. nên b&#7841;n không th&#7875; xóa</p>";
24             }
25             
26             
break;
27     }
28 ?>
29
30 <?
31     
if (isset($_POST['ButDel'])) {
32         $cnt=
0;
33         
foreach ($_POST['chk'] as $id)
34         {
35             @$result = mysql_query(
"delete from bds_price where id='".$id."'",$con);
36             
if ($result) $cnt++;
37         }
38         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
39     }
40 ?>
41 <?
42     $page = $_GET[
"page"];
43     $p=
0;
44     
if ($page!='') $p=$page;
45     $
where="1=1";
46     
if ($_REQUEST['cat']!='') $where="parent=".$_REQUEST['cat'];
47 ?>
48 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
49 <input type=hidden name=
"page" value="<? echo $page; ?>">
50 <?
51 function taotrang($sql,$link,$nitem,$itemcurrent)
52 {
global $con;
53     $ret=
"";
54     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
55     $
value = mysql_fetch_array($result);
56     $plus = (($
value['cnt'] % $nitem)>0);
57     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
58     {
59         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
60         
else $ret .= ($i+1)." ";
61     }
62     
return $ret;
63 }
64     $pageindex=taotrang(
"select count(*) from bds_price where $where","./?act=bds_price&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
65 ?>
66
67 <table cellspacing=
"0" cellpadding="0" width="100%">
68 <tr>
69 <td
class="smallfont" style="padding-top:10px;padding-bottom:10px">
70 <input type=
"button" value="+ Thêm mới" class="button" onclick="window.location='./?act=price_m&page=<? echo $_REQUEST['page']; ?>&cat=<? echo $_REQUEST['cat']; ?>'">
71 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button">
72 </td>
73 <td height=
"30" align="right" class="smallfont">
74     </td>
75 </tr>
76 </table>
77
78 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
79   <tr>
80     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
81     <td nowrap
class="title">&nbsp;</td>
82     <td nowrap
class="title">&nbsp;</td>
83     <td align=
"center" nowrap class="title"><b>Code</b></td>
84     <td align=
"center" nowrap class="title"><b>Name</b></td>
85     <td align=
"center" nowrap class="title"><b>Danh muc</b></td>
86     <td align=
"center" nowrap class="title"><b>Order</b></td>
87   </tr>
88   
89   <?
90                 $sql=
"select * from bds_price where $where order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
91                 $result=mysql_query($sql,$con);
92                 $i=
0;
93                 
while(($row=mysql_fetch_array($result)))
94                 {
95                     $sql_cat=mysql_query(
"SELECT * FROM cat where id='".$row['cat_id']."'");
96                     $row_cat=mysql_fetch_assoc($sql_cat);
97                     $i++;
98                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
99   ?>
100   
101   <tr>
102     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
103     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
104     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
105     <a href=
"./?act=price_m&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
106     S&#
7917;a</a></td>
107     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
108     <a href=
"./?act=price&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
109     Xoá</a></td>
110     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
111     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['name']; ?>&nbsp;</td>
112     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row_cat['name']; ?>&nbsp;</td>
113     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['thutu']; ?>&nbsp;</td>
114   </tr>
115   <?
116                 }
117   ?>
118 </table>
119 <table cellspacing=
"0" cellpadding="0" width="100%">
120 <tr>
121 <td
class="smallfont" style="padding-top:10px;padding-bottom:10px">
122 <input type=
"button" value="+ Thêm mới" class="button" onclick="window.location='./?act=price_m&page=<? echo $_REQUEST['page']; ?>&cat=<? echo $_REQUEST['cat']; ?>'">
123 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button">
124 </td>
125 <td height=
"30" align="right" class="smallfont">
126     </td>
127 </tr>
128 </table>
129 <input type=
"hidden" name="act" value="price">
130 </form>
131 <script language=
"JavaScript">
132 function chkallClick(o) {
133     
var form = document.frmList;
134     
for (var i = 0; i < form.elements.length; i++) {
135         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
136             form.elements[i].
checked = document.frmList.chkall.checked;
137         }
138     }
139 }
140 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.995 lượt xem

Gõ tìm kiếm nhanh...